package com.dzt.androidframework.changeskin.lib.utils;

import android.util.Log;

/**
 * Created by zhy on 15/9/23.
 */
public class L {
	private static final String TAG = "Skin";
	private static boolean debug = true;
	public static final String SEPARATOR = ",";

	public static void e(String msg) {
		if (debug) {
			StackTraceElement stackTraceElement = Thread.currentThread()
					.getStackTrace()[3];
			Log.e(TAG, getLogInfo(stackTraceElement) + msg);
		}
	}

	private static String getLogInfo(StackTraceElement stackTraceElement) {
		StringBuilder sb = new StringBuilder();

		// long threadID = Thread.currentThread().getId();

		String fileName = stackTraceElement.getFileName();

		// String className = stackTraceElement.getClassName();

		// String methodName = stackTraceElement.getMethodName();

		int lineNumber = stackTraceElement.getLineNumber();

		sb.append("[ ");
		// sb.append("threadID= " + threadID).append(SEPARATOR);
		// sb.append("method= " + methodName).append(SEPARATOR);
		sb.append("Name= ").append(fileName).append(SEPARATOR);
		sb.append("Number= ").append(lineNumber);
		sb.append(" ] ");
		return sb.toString();
	}
}
